//
//  MyTabBar.m
//  zhuayin
//
//  Created by wujian on 2016/10/28.
//  Copyright © 2016年 wujian. All rights reserved.
//

#import "MyTabBar.h"

@interface MyTabBar()

@property(nonatomic,strong)UIButton *centerBtn;


/**
 黄色透明
 */
@property(nonatomic,strong)UIView *lineNoticeView;


/**
 顶部图片
 */
@property(nonatomic,strong)UIImageView *imageView;

@end

@implementation MyTabBar

-(id)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = CSClearColor;
        
        
        
        
    }
    
    return self;

}

#pragma mark 重新布局视图
-(void)layoutSubviews{

    [super layoutSubviews];
    
    
    //调整uitabbarbutton的大小和位置
    CGFloat buttonW = self.frame.size.width / (self.items.count);
    CGFloat buttonH;
    
    if (iPhoneX) {
        
        buttonH = self.frame.size.height - 30;
    }
    else{
        
        buttonH = self.frame.size.height;
    }
    CGFloat buttonY = 0;
    CGFloat buttonX = 0;
    int index = 0;
    
    for (UIView *chidView in self.subviews) {
        
        if ([chidView isKindOfClass:NSClassFromString(@"UITabBarButton")]) {
            
            buttonX = index *buttonW;
            
            index++;
            
            chidView.frame = CGRectMake(buttonX, buttonY, buttonW, buttonH);
        }
    }
}

@end
